<%--
    Document   : manageFood
    Created on : Feb 18, 2013, 5:06:59 PM
    Author     : DungTT
--%>

<%@page pageEncoding="UTF-8" contentType='text/html;charset=UTF-8'%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
    "http://www.w3.org/TR/html4/loose.dtd">
<%@taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<%@taglib uri="http://java.sun.com/jsp/jstl/xml" prefix="x"%>
<%@ taglib uri="http://displaytag.sf.net" prefix="display"%>

<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <title>Manage Food Page</title>
        <script type="text/javascript" >
            function exportmasterfile()
            {   var url='${pageContext.request.contextPath}/xml/Foods.pdf';
                window.open(url,'Download');
            }
        </script>
    </head>
    <body>

        <jsp:include page="adminHeader.jsp"/>
        <form action="ControllerServlet" method="POST">
            Tên đô ăn: <input type="text" name="txtFoodName" value="" />
            <input type="submit" value="SearchFood" name="btnAction" />
            <input type="submit" value="CreatePDFFood" name="btnAction" />
        </form>
        
        <div>
            <c:choose>
                <c:when test="${empty sessionScope.resultFood }">
                    <h2>Food not found</h2>
                </c:when>
                <c:otherwise>
                    <display:table name="sessionScope.resultFood" pagesize="8"
                                   export="false" sort="list" id="row" >
                        <display:column property="foodName" title="Food Name"
                                        sortable="true" headerClass="sortable" />
                        <display:column property="calorie" title="Calories"
                                        sortable="true" headerClass="Image" />
                        <display:column property="carb" title="Carb"
                                        sortable="true" headerClass="Image" />
                        <display:column property="protein" title="Protein"
                                        sortable="true" headerClass="Image" />
                        <display:column property="fat" title="Fat"
                                        sortable="true" headerClass="Image" />
                        <display:column title="Image" sortable="true"
                                        headerClass="sortable" >
                            <img alt=""  src="${pageContext.request.contextPath}/images/food/${row.imageURL}" width="200" height="200"/>
                        </display:column>
                    </display:table>
                </c:otherwise>
            </c:choose>
        </div>

    </body>
</html>
